package book;
class by_self extends Exception{
    public by_self(String e) {
        super(e);//e是出错的原因
    }
}
public class Hh {
    public static void main(String[] args) throws by_self{
        throw new by_self("这其实没什么错");
    }
    public static void text() throws NullPointerException{
        try {
            int[] a = null;
            System.out.println(a.length);//会有空指针引用异常，在方法体中，没有处理
        } catch (ArrayIndexOutOfBoundsException e) {

        }finally {
            show(1);//System.out.println("show "+a);
        }
        show(2);
    }

    public static void show(int a) {
        System.out.println("show "+a);
    }
    public static void text2() throws CloneNotSupportedException {//受查异常必须处理

    }

    static int text3() {
        try {
            int[] a = null;
            System.out.println(a.length);//空指针应用
        } /*catch (NullPointerException e) {
            System.out.println("处理这个异常");
            return 2;
        }*/ finally {
            System.out.println("ed");
            return 1;
        }
    }

    public static void main1(String[] args) {
        int[] arr = new int[2];
        int a = 0;
        text();
//       text2();
        System.out.println("hhh");
        text3();
        System.out.println("返回值是 "+text3());

    }
}
